package it.koutifaris.travianmap.gui;

import it.koutifaris.travianmap.R;
import it.koutifaris.travianmap.model.Tribe;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

public class ImageFactory {
	private static Bitmap village[] = new Bitmap[Tribe.values().length];

	public static Bitmap getVillage(Resources res, Tribe race) {
		if (village[race.ordinal()] == null)
			village[race.ordinal()] = getVillageImage(res, race);
		return village[race.ordinal()];
	}

	private static Bitmap getVillageImage(Resources res, Tribe race) {
		switch (race) {
		case GAUL:
			return BitmapFactory.decodeResource(res, R.drawable.gaul_village);
		case NATARS:
			return BitmapFactory.decodeResource(res, R.drawable.natar_village);
		case ROMAN:
			return BitmapFactory.decodeResource(res, R.drawable.roman_village);
		case TEUTON:
			return BitmapFactory.decodeResource(res, R.drawable.teuton_village);
		default:
			return null;
		}
	}

}
